<?php
/* @var $this View */
/* @var $content string */

use app\Themes\LongYu\widgets\ThemeAsset;
use DuAdmin\Helpers\AppHelper;
use DuAdmin\Models\Navigation;
use DuAdmin\Widgets\AutoFixBootstrapColumn;
use DuAdmin\Widgets\DefaultPageFooter;
use DuAdmin\Widgets\LazyLoad;
use DuAdmin\Widgets\Nav;
use DuAdmin\Widgets\Notify;
use Frontend\Assets\AppAsset;
use yii\bootstrap\Modal;
use yii\bootstrap\NavBar;
use yii\helpers\Html;
use yii\web\View;
use yii\widgets\Breadcrumbs;

AppAsset::register( $this );
ThemeAsset::register( $this );
Notify::widget();
LazyLoad::widget();
$this->registerJs( AppHelper::getSetting( 'site.tongji' ), View::POS_HEAD );
$this->params[ 'logo' ] = AppHelper::getSetting( 'site.logo' );
$company = AppHelper::getSetting( 'site.company' );
$siteName = Yii::t( 'app', AppHelper::getSetting( 'site.name', Yii::$app->name ) );
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">

    <head>
        <base href="<?= Yii::$app->request->baseUrl ?>/">
        <meta charset="<?= Yii::$app->charset ?>">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <?= Html::csrfMetaTags() ?>
        <title><?= Html::encode( $this->title . '-' . $siteName . '-' . $company ) ?></title>
        <?php
        $this->head();
        ?>
    </head>

    <body>
        <?php $this->beginBody() ?>

        <div class="wrap">
            <?php
            NavBar::begin( [
                'brandLabel' => $siteName,
                // 'brandImage' => $this->params['logo'],
                'brandUrl'   => [
                    '/site/index'
                ],
                'brandOptions' => [
                    'title' => $siteName . '-' . $company
                ],
                'options'    => [
                    'class'          => 'navbar-default nav-affix',
                    'data-affix-one' => 'true'
                ]
            ] );
            $menus = [
                [
                    'label' => Yii::t( 'yii', 'Home' ),
                    'url'   => [
                        '/site/index'
                    ]
                ]
            ];
            $navigations = Navigation::getNavigation( 'frontend' );
            $menus = array_merge( $menus, $navigations );

            echo Nav::widget( [
                'options'         => [
                    'class' => 'navbar-nav navbar-right text-uppercase'
                ],
                'activateParents' => true,
                'items'           => $menus
            ] );
            NavBar::end();
            AutoFixBootstrapColumn::widget();
            ?>
            <?php
            if ( isset( $this->params[ 'breadcrumbs' ] ) ) :
                ?>
                <div class="container">
                    <?= Breadcrumbs::widget( [ 'links' => isset( $this->params[ 'breadcrumbs' ] ) ? $this->params[ 'breadcrumbs' ] : [] ] ) ?>
                </div>
            <?php endif;
            ?>
            <?= $content ?>
        </div>

        <?=
        DefaultPageFooter::renderPageFooter( [
            'viewName' => '@app/Themes/LongYu/layouts/footer',
        ] )
        ?>
        <?php
        Modal::begin( [
            'id'   => 'kefu-dailog',
            //'header' => '客服微信',
            'size' => Modal::SIZE_SMALL
        ] );
        ?>
        <?= Html::img( AppHelper::getSetting( "site.qr" ) ); ?>
        <?php Modal::end(); ?>
        <?php $this->endBody(); ?>
    </body>

</html>
<?php $this->endPage(); ?>